<?php
class m_store extends Zmodel{
    function __construct() {
   	    parent::__construct();
    }
	
	function select_shop($id){
		$this->load->database();
		/*select_shop($num, $offset, $id){
		 * $sqlstatement="SELECT p.product_id,
            			 	  p.product_name,
            			 	  p.product_desc,
            				  p.price,
            				  p.date_post,
            				  p.date_close,
            				  p.classify_id,
            				  c.classify_desc,
            				  p.user_id,
            				  u.user_login,
            		 		  p.file_path
            			 FROM product_ads AS p INNER JOIN classify_categories AS c ON p.classify_id = c.classify_id 
            			 INNER JOIN users AS u ON p.user_id=u.user_id
            			 WHERE u.user_login ='".$id."'
            			 ORDER BY p.date_post DESC
          		  	     LIMIT ".$num;
		if($offset==""){
            $sql=$sqlstatement." OFFSET 0";
        }else {
        	$sql=$sqlstatement." OFFSET ". $offset;
        }*/
        
		$sql="SELECT p.product_id,
            			 	  p.product_name,
            			 	  p.product_desc,
            				  p.price,
            				  p.date_post,
            				  p.date_close,
            				  p.classify_id,
            				  c.classify_desc,
            				  p.user_id,
            				  u.user_login,
            		 		  p.file_path
            			 FROM product_ads AS p INNER JOIN classify_categories AS c ON p.classify_id = c.classify_id 
            			 INNER JOIN users AS u ON p.user_id=u.user_id
            			 WHERE u.user_login ='".$id."'
            			 ORDER BY p.date_post DESC";
        return $this->db->query($sql);
	}
}

?>